from pylons import config

def bump_global_etag():
    config['mtp.page.global_etag'] += 1

def bump_page_etag(page_id):
    try:
        config['mtp.page.etags'][page_id] += 1
    except KeyError:
        config['mtp.page.etags'][page_id] = 1

def page_etag(page_id):
    return "%s%s" % (config['mtp.page.global_etag'], 
                     config['mtp.page.etags'].get(page_id, 0))
